<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="#{messages['partner.product.list']}">
	<h:panelGrid ><h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText></h:panelGrid>
	<rich:dataTable id="data" var="product" value="#{partnerProductMgtBean.productList}" rows="20" width="99%" >
		<rich:column style="text-align:center;width:20%;" >
			<f:facet name="header">
				<h:outputText value="#{messages['code']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{product.code}" rendered="#{!empty product.code}"></h:outputText>
			<h:outputText value="N/A" rendered="#{empty product.code}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['name']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{product.name}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['status']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{product.statusLabel}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['effective.date']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{product.effectiveDate}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['expiry.date']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{product.expiryDate}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:20%;">
			<f:facet name="header">
				<h:outputText value="#{messages['extension']}"></h:outputText>
			</f:facet>
			<h:commandButton styleClass="button" action="#{partnerProductMgtBean.navExtensionAction}" 
			rendered="#{!empty product.code}" actionListener="#{partnerProductMgtBean.navExtensionActionListener}"
			value="#{messages['action']}"></h:commandButton>
			<h:outputText value="N/A" rendered="#{empty product.code}"></h:outputText>
			<f:param value="#{product.partnerProductId}" id="productId"/>
		</rich:column>
		<rich:column style="text-align:center;width:20%;" >
			<f:facet name="header">
				<h:outputText value="Inventory"></h:outputText>
			</f:facet>
			<h:commandButton styleClass="button" action="#{partnerProductMgtBean.navInventoryAction}" 
			rendered="#{product.status=='partner.product.status.approved'}" actionListener="#{partnerProductMgtBean.navInventoryActionListener}"
			value="#{messages['action']}"></h:commandButton>
			<h:outputText value="N/A" rendered="#{product.status!='partner.product.status.approved'}"></h:outputText>
			<f:param value="#{product.partnerProductId}" id="productId2"/>
		</rich:column>
	</rich:dataTable>
	
	<rich:spacer height="30" />
	
	<rich:datascroller align="left"  for="data" maxPages="20" />

	<rich:spacer height="30" />
	<t:panelGrid columns="1">
		<h:commandButton value="#{messages['create']}" styleClass="button" action="#{partnerProductMgtBean.navCreateAction}" actionListener="#{partnerProductMgtBean.navPopulateListActionEvent}" immediate="true"></h:commandButton>
	</t:panelGrid>

            
</rich:panel>
